import path from 'path'

export default {
  db: {
    mongodb: {
      uri: process.env.MONGODB_URI,
    },
    redis: {
      host: process.env.REDIS_HOST,
      port: parseInt(process.env.REDIS_PORT!),
      username: process.env.REDIS_USERNAME,
      password: process.env.REDIS_PASSWORD,
    },
  },
  jwt: {
    secret: process.env.JWT_SECRET!,
    expiresIn: '7d',
  },
  server: {
    port: parseInt(process.env.PORT!),
    host: process.env.HOST || '0.0.0.0',
  },
  media: {
    rtmp: {
      port: parseInt(process.env.RTMP_PORT!),
      chunk_size: 60000,
      gop_cache: true,
      ping: 30,
      ping_timeout: 60,
    },
    http: {
      port: parseInt(process.env.HTTP_PORT!),
      allow_origin: process.env.CLIENT_URL,
      mediaroot: path.join(process.cwd(), process.env.MEDIA_ROOT!),
    },
    paths: {
      recordings: path.join(process.cwd(), 'recordings'),
      thumbnails: path.join(process.cwd(), 'public', 'thumbnails'),
      uploads: path.join(process.cwd(), process.env.UPLOAD_DIR!),
    },
    maxFileSize: parseInt(process.env.MAX_FILE_SIZE!),
  },
  client: {
    url: process.env.CLIENT_URL!,
  },
  stream: {
    keySecret: process.env.STREAM_KEY_SECRET!,
  },
}
